<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Over The Air (OTA) Update Library: OTA Agent Callback</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="infineon_logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Over The Air (OTA) Update Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="modules.html"><span>API&#160;Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__ota__callback.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#typedef-members">Typedefs</a>  </div>
  <div class="headertitle">
<div class="title">OTA Agent Callback<div class="ingroups"><a class="el" href="group__group__cy__ota.html">Infineon Over The Air (OTA) API</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>An application can get callbacks from the OTA Agent. </p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga6cd0e1cbbf15c4772a98e65463dcac0a"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="group__group__ota__typedefs.html#ga83280df2ca46db528cc12901d949fd63">cy_ota_callback_results_t</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ota__callback.html#ga6cd0e1cbbf15c4772a98e65463dcac0a">cy_ota_callback_t</a> )(<a class="el" href="structcy__ota__cb__struct__t.html">cy_ota_cb_struct_t</a> *cb_data)</td></tr>
<tr class="memdesc:ga6cd0e1cbbf15c4772a98e65463dcac0a"><td class="mdescLeft">&#160;</td><td class="mdescRight">OTA Agent callback to the application.  <a href="#ga6cd0e1cbbf15c4772a98e65463dcac0a">More...</a><br /></td></tr>
<tr class="separator:ga6cd0e1cbbf15c4772a98e65463dcac0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0fbb65fe9c9e93187a528827ca77f30b"><td class="memItemLeft" align="right" valign="top">typedef cy_rslt_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ota__callback.html#ga0fbb65fe9c9e93187a528827ca77f30b">cy_ota_file_open</a> )(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr)</td></tr>
<tr class="memdesc:ga0fbb65fe9c9e93187a528827ca77f30b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates and open new receive file for the data chunks as they come in.  <a href="#ga0fbb65fe9c9e93187a528827ca77f30b">More...</a><br /></td></tr>
<tr class="separator:ga0fbb65fe9c9e93187a528827ca77f30b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae366f3494efffa34e64372f761650818"><td class="memItemLeft" align="right" valign="top">typedef cy_rslt_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ota__callback.html#gae366f3494efffa34e64372f761650818">cy_ota_file_read</a> )(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr, <a class="el" href="group__group__ota__structures.html#ga2d730f21129ca8e6841f71c351df503f">cy_ota_storage_read_info_t</a> *chunk_info)</td></tr>
<tr class="memdesc:gae366f3494efffa34e64372f761650818"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads the flash data starting from the given offset.  <a href="#gae366f3494efffa34e64372f761650818">More...</a><br /></td></tr>
<tr class="separator:gae366f3494efffa34e64372f761650818"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga492aecddf859d8f6923e6f569aa40f46"><td class="memItemLeft" align="right" valign="top">typedef cy_rslt_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ota__callback.html#ga492aecddf859d8f6923e6f569aa40f46">cy_ota_file_write</a> )(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr, <a class="el" href="structcy__ota__storage__write__info__t.html">cy_ota_storage_write_info_t</a> *chunk_info)</td></tr>
<tr class="memdesc:ga492aecddf859d8f6923e6f569aa40f46"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a data to the flash at the given offset.  <a href="#ga492aecddf859d8f6923e6f569aa40f46">More...</a><br /></td></tr>
<tr class="separator:ga492aecddf859d8f6923e6f569aa40f46"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga20fd7fa81c8d0a17e601eb935f68ca3c"><td class="memItemLeft" align="right" valign="top">typedef cy_rslt_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ota__callback.html#ga20fd7fa81c8d0a17e601eb935f68ca3c">cy_ota_file_close</a> )(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr)</td></tr>
<tr class="memdesc:ga20fd7fa81c8d0a17e601eb935f68ca3c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Close the underlying receive file in the specified OTA context.  <a href="#ga20fd7fa81c8d0a17e601eb935f68ca3c">More...</a><br /></td></tr>
<tr class="separator:ga20fd7fa81c8d0a17e601eb935f68ca3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafb6b9845f940fc3f26a31345c61fdc25"><td class="memItemLeft" align="right" valign="top">typedef cy_rslt_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ota__callback.html#gafb6b9845f940fc3f26a31345c61fdc25">cy_ota_file_verify</a> )(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr)</td></tr>
<tr class="memdesc:gafb6b9845f940fc3f26a31345c61fdc25"><td class="mdescLeft">&#160;</td><td class="mdescRight">Authenticate received OTA update file specified in the OTA context.  <a href="#gafb6b9845f940fc3f26a31345c61fdc25">More...</a><br /></td></tr>
<tr class="separator:gafb6b9845f940fc3f26a31345c61fdc25"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga499d4a522c6d907be389fc57926dc4e6"><td class="memItemLeft" align="right" valign="top">typedef cy_rslt_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ota__callback.html#ga499d4a522c6d907be389fc57926dc4e6">cy_ota_file_validate</a> )(uint16_t app_id)</td></tr>
<tr class="memdesc:ga499d4a522c6d907be389fc57926dc4e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">The application has validated the new OTA image.  <a href="#ga499d4a522c6d907be389fc57926dc4e6">More...</a><br /></td></tr>
<tr class="separator:ga499d4a522c6d907be389fc57926dc4e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa82e4cd345bade48fe6fee8bb35fc2e9"><td class="memItemLeft" align="right" valign="top">typedef cy_rslt_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ota__callback.html#gaa82e4cd345bade48fe6fee8bb35fc2e9">cy_ota_file_get_app_info</a> )(void *file_des, <a class="el" href="structcy__ota__app__info__t.html">cy_ota_app_info_t</a> *app_info)</td></tr>
<tr class="memdesc:gaa82e4cd345bade48fe6fee8bb35fc2e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get Application info like Application version and Application ID.  <a href="#gaa82e4cd345bade48fe6fee8bb35fc2e9">More...</a><br /></td></tr>
<tr class="separator:gaa82e4cd345bade48fe6fee8bb35fc2e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="ga6cd0e1cbbf15c4772a98e65463dcac0a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="group__group__ota__typedefs.html#ga83280df2ca46db528cc12901d949fd63">cy_ota_callback_results_t</a>( * cy_ota_callback_t)(<a class="el" href="structcy__ota__cb__struct__t.html">cy_ota_cb_struct_t</a> *cb_data)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>OTA Agent callback to the application. </p>
<p>The application can use the callback to override default OTA functions.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">cb_data</td><td>Current information that Application callback can use/modify.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_OTA_CB_RSLT_OTA_CONTINUE CY_OTA_CB_RSLT_OTA_STOP CY_OTA_CB_RSLT_APP_SUCCESS CY_OTA_CB_RSLT_APP_FAILED </dd></dl>

</div>
</div>
<a class="anchor" id="ga0fbb65fe9c9e93187a528827ca77f30b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef cy_rslt_t( *  cy_ota_file_open)(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates and open new receive file for the data chunks as they come in. </p>
<dl class="section note"><dt>Note</dt><dd>ota-update library expects user to implement this callback function.</dd>
<dd>
Opens the file indicated in the OTA agent storage context in the MCU file system.</dd>
<dd>
The previous image may be present in the designated image download partition or file, so the partition or file must be completely erased or overwritten in this routine.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">storage_ptr</td><td>Pointer to the OTA Agent storage context <a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_OPEN_STORAGE </dd></dl>

</div>
</div>
<a class="anchor" id="gae366f3494efffa34e64372f761650818"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef cy_rslt_t( *  cy_ota_file_read)(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr, <a class="el" href="group__group__ota__structures.html#ga2d730f21129ca8e6841f71c351df503f">cy_ota_storage_read_info_t</a> *chunk_info)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads the flash data starting from the given offset. </p>
<dl class="section note"><dt>Note</dt><dd>ota-update library expects user to implement this callback function.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">storage_ptr</td><td>Pointer to the OTA Agent storage context <a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">chunk_info</td><td>Pointer to the chunk information which includes buffer, length, and offset.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_READ_STORAGE </dd></dl>

</div>
</div>
<a class="anchor" id="ga492aecddf859d8f6923e6f569aa40f46"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef cy_rslt_t( *  cy_ota_file_write)(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr, <a class="el" href="structcy__ota__storage__write__info__t.html">cy_ota_storage_write_info_t</a> *chunk_info)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Write a data to the flash at the given offset. </p>
<dl class="section note"><dt>Note</dt><dd>ota-update library expects user to implement this callback function.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">storage_ptr</td><td>Pointer to the OTA Agent storage context <a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">chunk_info</td><td>Pointer to the chunk information which includes buffer, length, and offset.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_WRITE_STORAGE </dd></dl>

</div>
</div>
<a class="anchor" id="ga20fd7fa81c8d0a17e601eb935f68ca3c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef cy_rslt_t( *  cy_ota_file_close)(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Close the underlying receive file in the specified OTA context. </p>
<dl class="section note"><dt>Note</dt><dd>ota-update library expects user to implement this callback function.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">storage_ptr</td><td>Pointer to the OTA Agent storage context <a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_CLOSE_STORAGE </dd></dl>

</div>
</div>
<a class="anchor" id="gafb6b9845f940fc3f26a31345c61fdc25"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef cy_rslt_t( *  cy_ota_file_verify)(<a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a> *storage_ptr)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Authenticate received OTA update file specified in the OTA context. </p>
<dl class="section note"><dt>Note</dt><dd>ota-update library expects user to implement this callback function.</dd>
<dd>
Authentication method is user choice.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">storage_ptr</td><td>Pointer to the OTA Agent storage context <a class="el" href="structcy__ota__storage__context__t.html">cy_ota_storage_context_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_VERIFY </dd></dl>

</div>
</div>
<a class="anchor" id="ga499d4a522c6d907be389fc57926dc4e6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef cy_rslt_t( *  cy_ota_file_validate)(uint16_t app_id)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The application has validated the new OTA image. </p>
<dl class="section note"><dt>Note</dt><dd>This call must be after reboot and updated image is booted.</dd>
<dd>
Calling this API makes currently executing image as boot image until next update.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">app_id</td><td>Application ID.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; error codes otherwise. </dd></dl>

</div>
</div>
<a class="anchor" id="gaa82e4cd345bade48fe6fee8bb35fc2e9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef cy_rslt_t( *  cy_ota_file_get_app_info)(void *file_des, <a class="el" href="structcy__ota__app__info__t.html">cy_ota_app_info_t</a> *app_info)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get Application info like Application version and Application ID. </p>
<dl class="section note"><dt>Note</dt><dd>ota-update library expects user to implement this callback function. </dd>
<dd>
This API implementation is optional for MCUBootloader based OTA.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">void*</td><td>Pointer to file descriptor. It can be cast as flash_area or FILE as needed. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">cy_ota_app_info_t*</td><td>Pointer to the OTA Application information context <a class="el" href="structcy__ota__app__info__t.html">cy_ota_app_info_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_GENERAL </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>Over The Air (OTA) Update Library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
</body>
</html>
